package com.hn.kiss.config.validdator;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;


/**
 * 自定义日期字符串校验注解
 */
@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
@Retention(RUNTIME)
@Documented
@Constraint(validatedBy = { IsTimeValidator.class})
public @interface IsTime {
 
    //默认错误消息
    String message() default "时间格式不和法,应为(yyyy-MM-dd)";
 
    //分组
    Class<?>[] groups() default { };
 
    //负载
    Class<? extends Payload>[] payload() default { };
 
    //指定多个时使用
    @Target({ FIELD, METHOD, PARAMETER, ANNOTATION_TYPE })
    @Retention(RUNTIME)
    @Documented
    @interface List {
    	IsTime[] value();
    }
}
